/* 1784. 检查二进制字符串字段 */
/**
 * @param {string} s
 * @return {boolean}
 */
var checkOnesSegment = function (s) {
	let = count = 0
	const len = s.length
	for (let i = 0; i < len; i++) {
		let j = i
		if (s[i] === '1') {
			for (; j < len; j++) {
				if (s[j] !== '1') break
			}
			count++
		}
		i = j === i ? i : j - 1
	}
	return count < 2
}

var checkOnesSegment = function (s) {
	return s.indexOf('01') === -1
}
const result = checkOnesSegment('1')
console.log('checkOnesSegment :>>', result)
